package com.hqyj.onlineExamination.modules.common.entity;

//接受从数据库查询的结果集
public class ResultEntity<T> {
    //设置的状态码
    private int status;
    //设置的信息
    private String message;
    //操作的实体类
    private T data;

    public ResultEntity() {
    }

    public ResultEntity(int status, String message) {
        this.status = status;
        this.message = message;
    }

    public ResultEntity(int status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    //以枚举的类型设置状态码
    public enum ResultStatus{
        //成功返回200 失败返回500
        SUCCESS(200),FAILED(500);

        public int status;

        ResultStatus(int status) {
            this.status = status;
        }
    }
}
